import sys
from grab_ui import Ui_MainWindow
from PyQt5.QtWidgets import *
from PyQt5 import  QtCore
class GrabWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setWindowTitle("HRobot")
        self.ui.pushButtonVision.clicked.connect(self.onButtonVision)
        self.ui.pushButtonTask.clicked.connect(self.onButtonTask)
        self.ui.pushButton_Scan.clicked.connect(self.onButton_Scan)
        self.ui.pushButton_Robot.clicked.connect(self.onButtonRobot)

        self.ui.labelAGVStateLight.setGeometry(QtCore.QRect(160, 80, 11, 11))
        self.ui.labelAGVStateLight.setStyleSheet \
            ("background-color: rgb(58, 111, 50);\n""border-radius: 40px; border:\n"" 3px groove gray;border-style: outset;")

        self.ui.labelAGVStateLight.setText("")
        self.ui.labelAGVStateLight.setObjectName("label")

        self.ui.labelARMStateLight.setGeometry(QtCore.QRect(160, 80, 11, 11))
        self.ui.labelARMStateLight.setStyleSheet \
            ("background-color: rgb(58, 111, 50);\n""border-radius: 40px; border:\n"" 3px groove gray;border-style: outset;")

        self.ui.labelARMStateLight.setText("")
        self.ui.labelARMStateLight.setObjectName("label")

        self.ui.labelCameraStateLight.setGeometry(QtCore.QRect(160, 80, 11, 11))
        self.ui.labelCameraStateLight.setStyleSheet \
            ("background-color: rgb(58, 111, 50);\n""border-radius: 40px; border:\n"" 3px groove gray;border-style: outset;")

        self.ui.labelCameraStateLight.setText("")
        self.ui.labelCameraStateLight.setObjectName("label")


    def onButtonVision(self):
        self.ui.tabWidget.setCurrentIndex(0)

    def onButtonTask(self):
        self.ui.tabWidget.setCurrentIndex(1)

    def onButton_Scan(self):
        self.ui.tabWidget.setCurrentIndex(2)

    def onButtonRobot(self):
        self.ui.tabWidget.setCurrentIndex(3)

class QSSLoader:
    def __init__(self):
        pass
    @staticmethod
    def read_qss_file(qss_file_name):
        with open(qss_file_name, 'r', encoding='UTF-8') as file:
            return file.read()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    main_win = GrabWindow()
    # apply_stylesheet(app, theme='light_blue.xml')
    main_win.show()
    sys.exit(app.exec_())

